* Exchange Rates and Economic Growth during the Global Business Cycle: The Role of Labor Market Institutions
* December 2024: Asali, M.; Kuokštis, V.; Spurga, S. A.

********************************************************
* Benchmark (Terrones 2020): no Labor Market Flexibility
********************************************************
use FXR_LMF_DATA, clear
keep if Restricted==1
* Static Long Regression:
xtreg growth lFXR Recession Recovery FRes FRec L.lngdpp Year lnPOP PGR polity ka_open ROW FreeFalling, fe vce(robust) 
nlcom ( _b[lFXR]+_b[FRec] )
nlcom ( _b[FRec] )

**********************************************************
* Effects with Labor Market Flexibility: Restricted sample
**********************************************************
use FXR_LMF_DATA, clear
keep if Restricted==1
* Static Long Regression:
xtreg growth lFXR lLMF Recession Recovery FLMF FRes FRec LRes LRec FLRes FLRec L.lngdpp Year lnPOP PGR polity ka_open ROW FreeFalling, fe vce(robust) 
 // Total and partial effect of fixed in recovery: LMF=0
nlcom ( _b[lFXR]+_b[FRec] )
nlcom ( _b[FRec] )

  // Total and partial effect of fixed in recovery: LMF=10
nlcom ( _b[lFXR]+_b[FRec]+_b[FLMF]*10+10*_b[FLRec] )
nlcom ( _b[FRec]+10*_b[FLRec] )

****************************************************
* Effects with Labor Market Flexibility: Full sample
****************************************************
use FXR_LMF_DATA, clear
* Static Short Regression:
xtreg growth lFXR lLMF Recession Recovery FLMF FRes FRec LRes LRec FLRes FLRec L.lngdpp Year lnPOP PGR polity ka_open, fe vce(robust) 
 // Total and partial effect of fixed in recovery: LMF=0
nlcom ( _b[lFXR]+_b[FRec] )
nlcom ( _b[FRec] )
 
 // Total and partial effect of fixed in recovery: LMF=10
nlcom ( _b[lFXR]+_b[FRec]+_b[FLMF]*10+10*_b[FLRec] )
nlcom ( _b[FRec]+10*_b[FLRec] )

* Dynamic Short Regression:
xtabond2 growth L.growth lFXR lLMF Recession Recovery FLMF FRes FRec LRes LRec FLRes FLRec L.lngdpp Year lnPOP PGR polity ka_open, gmm(growth , lag(2 4) collapse) iv(lFXR lLMF Recession Recovery FLMF FRes FRec LRes LRec FLRes FLRec L.lngdpp Year lnPOP PGR polity ka_open, eq(level)  ) small robust 

 // Total and partial effect of fixed in recovery: LMF=0
nlcom ( _b[lFXR]+_b[FRec] )/ (1-_b[L.growth])
nlcom ( _b[FRec] )/ (1-_b[L.growth])
  // Total and partial effect of fixed in recovery: LMF=10
nlcom ( _b[lFXR]+_b[FRec]+_b[FLMF]*10+10*_b[FLRec] )/ (1-_b[L.growth])
nlcom ( _b[FRec]+10*_b[FLRec] )/ (1-_b[L.growth])

* Static Long Regression:
xtreg growth lFXR lLMF Recession Recovery FLMF FRes FRec LRes LRec FLRes FLRec YER* L.lngdpp Year lnPOP PGR polity ka_open ROW FreeFalling, fe vce(robust) 
 // Total and partial effect of fixed in recovery: LMF=0
nlcom ( _b[lFXR]+_b[FRec] )
nlcom ( _b[FRec] )

  // Total and partial effect of fixed in recovery: LMF=10
nlcom ( _b[lFXR]+_b[FRec]+_b[FLMF]*10+10*_b[FLRec] )
nlcom ( _b[FRec]+10*_b[FLRec] )

* Dynamic Long regression:
xtabond2 growth L.growth lFXR lLMF Recession Recovery FLMF FRes FRec LRes LRec FLRes FLRec L.lngdpp Year lnPOP PGR polity ka_open ROW FreeFalling YER* , gmm(growth ROW, lag(2 4) collapse) iv(lFXR lLMF Recession Recovery FLMF FRes FRec LRes LRec FLRes FLRec L.lngdpp Year lnPOP PGR polity ka_open ROW FreeFalling YER*, eq(level)  ) small robust 

 // Total and partial effect of fixed in recovery: LMF=0
nlcom ( _b[lFXR]+_b[FRec] )/ (1-_b[L.growth])
nlcom ( _b[FRec] )/ (1-_b[L.growth])
 // Total and partial effect of fixed in recovery: LMF=10
nlcom ( _b[lFXR]+_b[FRec]+_b[FLMF]*10+10*_b[FLRec] )/ (1-_b[L.growth])
nlcom ( _b[FRec]+10*_b[FLRec] )/ (1-_b[L.growth])

***********************
* Panel Unit Root Tests
***********************
use FXR_LMF_DATA, clear
gen dLMF=d.lLMF
foreach VAR in growth lLMF dLMF PGR {
	qui reg `VAR' Year
	predict TT`VAR', res
	xtunitroot ips `VAR', trend lags(1)
	xtbunitroot TT`VAR', csd known(16) normal
	xtbunitroot TT`VAR', csd known(23) normal
	xtbunitroot TT`VAR', csd known(32) normal
}